<!doctype html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=robots content="noodp"><meta http-equiv=x-ua-compatible content="IE=edge, chrome=1"><title>Maven问题汇总 - Yulin Lewis' Blog</title><meta name=keywords content="雨临Lewis,Java,hugo,hexo,博客"><meta name=Description content="不想当写手的码农不是好咸鱼_(xз」∠)_"><meta property="og:title" content="Maven问题汇总"><meta property="og:description" content="设置阿里云国内镜像
从Maven的中央仓库下载jar包速度很慢，可以通过在settings.xml中配置一个国内镜像来提高下载速度，一般用阿里云镜像。注意，如果你同时有多个配置文件，必须要修改当前用户目录下的~/.m2下的settings.xml才有效。


1
2
3
4
5
6
7
8


<mirrors>  
    <mirror>  
        <id>alimaven</id>  
        <name>aliyun maven</name>  
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
        <mirrorOf>central</mirrorOf>          
    </mirror>  
</mirrors>"><meta property="og:type" content="article"><meta property="og:url" content="https://lewky.cn/posts/maven-issues/"><meta property="og:image" content="https://lewky.cn/logo.png"><meta property="article:published_time" content="2021-07-29T23:19:56+08:00"><meta property="article:modified_time" content="2021-09-07T23:19:56+08:00"><meta name=twitter:card content="summary_large_image"><meta name=twitter:image content="https://lewky.cn/logo.png"><meta name=twitter:title content="Maven问题汇总"><meta name=twitter:description content="设置阿里云国内镜像
从Maven的中央仓库下载jar包速度很慢，可以通过在settings.xml中配置一个国内镜像来提高下载速度，一般用阿里云镜像。注意，如果你同时有多个配置文件，必须要修改当前用户目录下的~/.m2下的settings.xml才有效。


1
2
3
4
5
6
7
8


<mirrors>  
    <mirror>  
        <id>alimaven</id>  
        <name>aliyun maven</name>  
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
        <mirrorOf>central</mirrorOf>          
    </mirror>  
</mirrors>"><meta name=application-name content="雨临Lewis的博客"><meta name=apple-mobile-web-app-title content="雨临Lewis的博客"><meta name=theme-color content="#ffffff"><meta name=msapplication-TileColor content="#da532c"><link rel="shortcut icon" type=image/x-icon href=/favicon.ico><link rel=icon type=image/png sizes=32x32 href=/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=/favicon-16x16.png><link rel=apple-touch-icon sizes=180x180 href=/apple-touch-icon.png><link rel=mask-icon href=/safari-pinned-tab.svg color=#5bbad5><link rel=manifest href=/site.webmanifest><link rel=canonical href=https://lewky.cn/posts/maven-issues/><link rel=prev href=https://lewky.cn/posts/swagger-issues/><link rel=next href=https://lewky.cn/posts/npm-issues/><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.min.css><link rel=stylesheet href=/css/style.min.css><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.13.0/css/all.min.css><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/animate.css@3.7.2/animate.min.css><script type=application/ld+json>{"@context":"http://schema.org","@type":"BlogPosting","headline":"Maven问题汇总","inLanguage":"","mainEntityOfPage":{"@type":"WebPage","@id":"https:\/\/lewky.cn\/posts\/maven-issues\/"},"genre":"posts","keywords":"Maven, 工作记录","wordcount":5525,"url":"https:\/\/lewky.cn\/posts\/maven-issues\/","datePublished":"2021-07-29T23:19:56+08:00","dateModified":"2021-09-07T23:19:56+08:00","license":"This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.","publisher":{"@type":"Organization","name":"雨临Lewis","logo":"https:\/\/lewky.cn\/images\/avatar.jpg"},"author":{"@type":"Person","name":"雨临Lewis"},"description":""}</script></head><body header-desktop=fixed header-mobile=auto><script type=text/javascript>(window.localStorage&&localStorage.getItem('theme')?localStorage.getItem('theme')==='dark':('auto'==='auto'?window.matchMedia('(prefers-color-scheme: dark)').matches:'auto'==='dark'))&&document.body.setAttribute('theme','dark');</script><div id=mask></div><div class=wrapper><header class=desktop id=header-desktop><div class=header-wrapper><a href=https://github.com/lewky class=github-corner target=_blank title="Follow me on GitHub" aria-label="Follow me on GitHub"><svg width="3.5rem" height="3.5rem" viewBox="0 0 250 250" style="fill:#70b7fd;color:#fff;position:absolute;top:0;border:0;left:0;transform:scale(-1,1)" aria-hidden="true"><path d="M0 0 115 115h15l12 27L250 250V0z"/><path d="M128.3 109C113.8 99.7 119 89.6 119 89.6 122 82.7 120.5 78.6 120.5 78.6 119.2 72 123.4 76.3 123.4 76.3 127.3 80.9 125.5 87.3 125.5 87.3 122.9 97.6 130.6 101.9 134.4 103.2" fill="currentcolor" style="transform-origin:130px 106px" class="octo-arm"/><path d="M115 115C114.9 115.1 118.7 116.5 119.8 115.4L133.7 101.6C136.9 99.2 139.9 98.4 142.2 98.6 133.8 88 127.5 74.4 143.8 58 148.5 53.4 154 51.2 159.7 51 160.3 49.4 163.2 43.6 171.4 40.1 171.4 40.1 176.1 42.5 178.8 56.2 183.1 58.6 187.2 61.8 190.9 65.4 194.5 69 197.7 73.2 200.1 77.6 213.8 80.2 216.3 84.9 216.3 84.9 212.7 93.1 206.9 96 205.4 96.6 205.1 102.4 203 107.8 198.3 112.5 181.9 128.9 168.3 122.5 157.7 114.1 157.9 116.9 156.7 120.9 152.7 124.9L141 136.5C139.8 137.7 141.6 141.9 141.8 141.8z" fill="currentcolor" class="octo-body"/></svg></a><div class=header-title><a href=/ title="Yulin Lewis' Blog"><span class=header-title-pre><i class="fas fa-fw fa-atom"></i></span>雨临Lewis</a></div><div class=menu><div class=menu-inner><div class=dropdown><a href=/posts/ class="menu-item menu-more dropbtn" title=点击查看所有文章><i class="fas fa-fw fa-archive"></i>归档</a><div class="menu-more-content dropdown-content"><a href=/categories/><i class="fas fa-fw fa-th"></i>分类 </a><a href=/tags/><i class="fas fa-fw fa-tag"></i>标签 </a><a href=/hot/ title=文章热度Top15><i class="fas fa-fw fa-fire"></i>热度 </a><a href=/donation/ title=感谢打赏，老板大气~><i class="fas fa-fw fa-donate"></i>打赏 </a><a href=/about/><i class="fas fa-fw fa-at"></i>关于</a></div></div><a class=menu-item href=/friends/ title=欢迎申请友链><i class="fas fa-fw fa-link"></i>友链</a><div class=dropdown><a href=javascript:void(0); class="menu-item menu-more dropbtn" title=一些有意思的东东~><i class="fas fa-fw fa-fan fa-spin"></i>趣味</a><div class="menu-more-content dropdown-content"><a href=/funny/high/ title="前方高能♂ 小心外放！" target=_blank rel=noopener><i class="fas fa-fw fa-dizzy"></i>燥起来！ </a><a href=/funny/mikutap/ title=初音未来音乐游戏 target=_blank rel=noopener><i class="fas fa-fw fa-music"></i>在线打碟 </a><a href=/funny/catch-the-cat/ title=逮住那只猫!><i class="fas fa-fw fa-cat"></i>抓住猫咪</a></div></div><div class=dropdown><a href=/ class="menu-item menu-more dropbtn" title=回到首页><i class="fas fa-fw fa-atom"></i>站点</a><div class="menu-more-content dropdown-content"><a href=/bbs/ title=来留言吧~><i class="fas fa-fw fa-comment"></i>公告留言 </a><a href=https://seo.chinaz.com target=_blank rel=noopener><i class="fas fa-fw fa-chart-line"></i>SEO查询 </a><a href=https://www.ping.cn/http/lewky.cn target=_blank rel=noopener><i class="fas fa-fw fa-bezier-curve"></i>网站测速 </a><a href=/posts/e62c38c4.html/><i class="fas fa-fw fa-cog fa-spin"></i>建站日志</a></div></div><div class=dropdown><a href=javascript:void(0); class="menu-item menu-more dropbtn"><i class="fas fa-fw fa-book"></i>文档</a><div class="menu-more-content dropdown-content"><a href=https://gohugo.io/documentation/ target=_blank rel=noopener><i class="fas fa-fw fa-star"></i>Hugo文档 </a><a href=https://javanote.doc.lewky.cn/ title=尚在完善中~ target=_blank rel=noopener><i class="fab fa-fw fa-java"></i>Java 笔记</a></div></div><a class=menu-item href=/search/ title=渲染搜索结果需要等待几秒钟~><i class="fas fa-fw fa-search"></i>搜索
</a><span class="menu-item delimiter"></span><a href=https://travellings.link target=_blank class=menu-item rel=noopener title=开往-友链接力><i class="fas fa-fw fa-subway"></i></a><a href=https://rssblog.vercel.app/ class=menu-item target=_blank rel=noopener title=RSSBlog><i class="fas fa-fw fa-inbox"></i></a><a href=https://github.com/lewky class=menu-item target=_blank rel=noopener title=GitHub><i class="fab fa-fw fa-github"></i></a></div></div></div></header><header class=mobile id=header-mobile><div class=header-container><div class=header-wrapper><div class=header-title><a href=/ title="Yulin Lewis' Blog"><span class=header-title-pre><i class="fas fa-fw fa-atom"></i></span>雨临Lewis</a></div><div class=menu-toggle id=menu-toggle-mobile><span></span><span></span><span></span></div></div><div class=menu id=menu-mobile><div class=dropdown><a href=/posts/ class="menu-item menu-more dropbtn" title=点击查看所有文章><i class="fas fa-fw fa-archive"></i>归档</a><div class="menu-more-content dropdown-content"><a href=/categories/><i class="fas fa-fw fa-th"></i>分类 </a><a href=/tags/><i class="fas fa-fw fa-tag"></i>标签 </a><a href=/hot/ title=文章热度Top15><i class="fas fa-fw fa-fire"></i>热度 </a><a href=/donation/ title=感谢打赏，老板大气~><i class="fas fa-fw fa-donate"></i>打赏 </a><a href=/about/><i class="fas fa-fw fa-at"></i>关于</a></div></div><a class=menu-item href=/friends/ title=欢迎申请友链><i class="fas fa-fw fa-link"></i>友链</a><div class=dropdown><a href=javascript:void(0); class="menu-item menu-more dropbtn" title=一些有意思的东东~><i class="fas fa-fw fa-fan fa-spin"></i>趣味</a><div class="menu-more-content dropdown-content"><a href=/funny/high/ title="前方高能♂ 小心外放！" target=_blank rel=noopener><i class="fas fa-fw fa-dizzy"></i>燥起来！ </a><a href=/funny/mikutap/ title=初音未来音乐游戏 target=_blank rel=noopener><i class="fas fa-fw fa-music"></i>在线打碟 </a><a href=/funny/catch-the-cat/ title=逮住那只猫!><i class="fas fa-fw fa-cat"></i>抓住猫咪</a></div></div><div class=dropdown><a href=/ class="menu-item menu-more dropbtn" title=回到首页><i class="fas fa-fw fa-atom"></i>站点</a><div class="menu-more-content dropdown-content"><a href=/bbs/ title=来留言吧~><i class="fas fa-fw fa-comment"></i>公告留言 </a><a href=https://seo.chinaz.com target=_blank rel=noopener><i class="fas fa-fw fa-chart-line"></i>SEO查询 </a><a href=https://www.ping.cn/http/lewky.cn target=_blank rel=noopener><i class="fas fa-fw fa-bezier-curve"></i>网站测速 </a><a href=/posts/e62c38c4.html/><i class="fas fa-fw fa-cog fa-spin"></i>建站日志</a></div></div><div class=dropdown><a href=javascript:void(0); class="menu-item menu-more dropbtn"><i class="fas fa-fw fa-book"></i>文档</a><div class="menu-more-content dropdown-content"><a href=https://gohugo.io/documentation/ target=_blank rel=noopener><i class="fas fa-fw fa-star"></i>Hugo文档 </a><a href=https://javanote.doc.lewky.cn/ title=尚在完善中~ target=_blank rel=noopener><i class="fab fa-fw fa-java"></i>Java 笔记</a></div></div><a class=menu-item href=/search/ title=渲染搜索结果需要等待几秒钟~><i class="fas fa-fw fa-search"></i>搜索</a>
<a href=https://travellings.link target=_blank class=menu-item rel=noopener title=开往-友链接力><i class="fas fa-fw fa-subway"></i></a><a href=https://rssblog.vercel.app/ class=menu-item target=_blank rel=noopener title=RSSBlog><i class="fas fa-fw fa-inbox"></i></a><a href=https://github.com/lewky class=menu-item target=_blank rel=noopener title=GitHub><i class="fab fa-fw fa-github"></i></a></div></div></header><div class="search-dropdown desktop"><div id=search-dropdown-desktop></div></div><div class="search-dropdown mobile"><div id=search-dropdown-mobile></div></div><main class=main><div class=container><div class=toc id=toc-auto><h2 class=toc-title>目录</h2><div class=toc-content id=toc-content-auto></div></div><article class="page single"><h1 class="single-title animated flipInX">Maven问题汇总</h1><div class=post-meta><div class=post-meta-line><span class=post-author><a href=/ title=Author rel=author class=author><i class="fas fa-user-circle fa-fw"></i>雨临Lewis</a></span>&nbsp;<span class=post-category>收录于 <a href=/categories/maven/><i class="far fa-folder fa-fw"></i>Maven</a></span></div><div class=post-meta-line><i class="far fa-calendar fa-fw"></i>&nbsp;<time datetime=2021-07-29>2021-07-29</time>&nbsp;<i class="far fa-calendar-plus fa-fw"></i>&nbsp;<time datetime=2021-09-07>2021-09-07</time>&nbsp;<i class="fas fa-pencil-alt fa-fw"></i>&nbsp;约 5525 字
<i class="far fa-clock fa-fw"></i>&nbsp;预计阅读 12 分钟&nbsp;<span id=/posts/maven-issues/ class=leancloud_visitors data-flag-title=Maven问题汇总>
<i class="far fa-eye fa-fw"></i>&nbsp;<span class=leancloud-visitors-count></span>&nbsp;次阅读
</span>&nbsp;
<a href=#comments id=post-meta-vcount title=查看评论><i class="fas fa-comment fa-fw"></i>&nbsp;<span id=/posts/maven-issues/ class=waline-comment-count></span>&nbsp;条评论</a></div></div><div class="details toc" id=toc-static kept><div class="details-summary toc-title"><span>目录</span>
<span><i class="details-icon fas fa-angle-right"></i></span></div><div class="details-content toc-content" id=toc-content-static><nav id=TableOfContents><ol><li><a href=#设置阿里云国内镜像>设置阿里云国内镜像</a></li><li><a href=#指定编译的jdk版本>指定编译的JDK版本</a></li><li><a href=#offline节点的作用>offline节点的作用</a></li><li><a href=#optional标签>optional标签</a></li><li><a href=#编码gbk的不可映射字符>编码GBK的不可映射字符</a></li><li><a href=#打war包的方式>打war包的方式</a></li><li><a href=#mvn-clean-package的执行顺序><code>mvn clean package</code>的执行顺序</a></li><li><a href=#设置下载源码和文档>设置下载源码和文档</a><ol><li><a href=#使用maven命令>使用Maven命令</a></li><li><a href=#修改配置文件进行全局配置>修改配置文件进行全局配置</a></li><li><a href=#在ide工具中配置>在IDE工具中配置</a></li></ol></li><li><a href=#maven聚合工程怎么变回普通的maven工程>Maven聚合工程怎么变回普通的Maven工程</a><ol><li><a href=#解决方法>解决方法</a></li></ol></li><li><a href=#javalangstackoverflowerror><code>java.lang.StackOverflowError</code></a></li><li><a href=#无法下载217js7版本的itext依赖>无法下载2.1.7.js7版本的itext依赖</a><ol><li><a href=#解决方法-1>解决方法</a></li></ol></li><li><a href=#javaawtfontformatexception-bad-table-tag><code>java.awt.FontFormatException: bad table, tag=</code></a></li><li><a href=#引入本地jar包>引入本地jar包</a><ol><li><a href=#方式一安装到本地仓库>方式一：安装到本地仓库</a></li><li><a href=#方式二systempath直接引入>方式二：<code>systemPath</code>直接引入</a></li></ol></li><li><a href=#压缩jscss代码>压缩js+css代码</a></li><li><a href=#跳过测试案例>跳过测试案例</a></li><li><a href=#参考链接>参考链接</a></li></ol></nav></div></div><div class=content id=content><h2 id=设置阿里云国内镜像>设置阿里云国内镜像</h2><p>从Maven的中央仓库下载jar包速度很慢，可以通过在<code>settings.xml</code>中配置一个国内镜像来提高下载速度，一般用阿里云镜像。<strong>注意，如果你同时有多个配置文件，必须要修改当前用户目录下的<code>~/.m2</code>下的<code>settings.xml</code>才有效。</strong></p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span><span class=lnt>4
</span><span class=lnt>5
</span><span class=lnt>6
</span><span class=lnt>7
</span><span class=lnt>8
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;mirrors&gt;</span>  
    <span class=nt>&lt;mirror&gt;</span>  
        <span class=nt>&lt;id&gt;</span>alimaven<span class=nt>&lt;/id&gt;</span>  
        <span class=nt>&lt;name&gt;</span>aliyun maven<span class=nt>&lt;/name&gt;</span>  
        <span class=nt>&lt;url&gt;</span>http://maven.aliyun.com/nexus/content/groups/public/<span class=nt>&lt;/url&gt;</span>  
        <span class=nt>&lt;mirrorOf&gt;</span>central<span class=nt>&lt;/mirrorOf&gt;</span>          
    <span class=nt>&lt;/mirror&gt;</span>  
<span class=nt>&lt;/mirrors&gt;</span> 
</code></pre></td></tr></table></div></div><p>修改配置后，需要重新打开命令行窗口，或者重启IDE才能生效。通常公司会在内网中自己架设一个Nexus私服，项目成员将镜像节点配置为公司的私服，这样无需连接外网也可以下载Jar包，而且速度更快。阿里云镜像实际上就是一个对外公开的Nexus私服仓库。</p><h2 id=指定编译的jdk版本>指定编译的JDK版本</h2><p>在<code>settings.xml</code>中配置如下：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt> 1
</span><span class=lnt> 2
</span><span class=lnt> 3
</span><span class=lnt> 4
</span><span class=lnt> 5
</span><span class=lnt> 6
</span><span class=lnt> 7
</span><span class=lnt> 8
</span><span class=lnt> 9
</span><span class=lnt>10
</span><span class=lnt>11
</span><span class=lnt>12
</span><span class=lnt>13
</span><span class=lnt>14
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;profiles&gt;</span>
	<span class=nt>&lt;profile&gt;</span>
		<span class=nt>&lt;id&gt;</span>jdk-1.8<span class=nt>&lt;/id&gt;</span>
		<span class=nt>&lt;activation&gt;</span>
			<span class=nt>&lt;jdk&gt;</span>1.8<span class=nt>&lt;/jdk&gt;</span>
			<span class=nt>&lt;activeByDefault&gt;</span>true<span class=nt>&lt;/activeByDefault&gt;</span>
		<span class=nt>&lt;/activation&gt;</span>
		<span class=nt>&lt;properties&gt;</span>
			<span class=nt>&lt;maven.compiler.source&gt;</span>1.8<span class=nt>&lt;/maven.compiler.source&gt;</span>
			<span class=nt>&lt;maven.compiler.target&gt;</span>1.8<span class=nt>&lt;/maven.compiler.target&gt;</span>
			<span class=nt>&lt;maven.compiler.compilerVersion&gt;</span>1.8<span class=nt>&lt;/maven.compiler.compilerVersion&gt;</span>
		<span class=nt>&lt;/properties&gt;</span>
	<span class=nt>&lt;/profile&gt;</span>
<span class=nt>&lt;/profiles&gt;</span>
</code></pre></td></tr></table></div></div><p>这是一种全局配置，当Maven项目的pom中没有指定编译插件的jdk版本时，会自动使用全局配置的版本。</p><h2 id=offline节点的作用>offline节点的作用</h2><p>企业项目通常更新很快，每天都会出一个snapshot包，在当天里第一次启动项目时，如果中央仓库里的snapshot包更新了，则会自动下载到本地。</p><p>如果你此时在本地更改了项目代码并打包过一次，在启动项目时恰巧中央仓库的jar包更新了，就会把本地打包好的jar包给替换掉了。此时必须重新打包一次，才能使用你之前修改的项目代码。为了避免这种情况，可以将<code>settings.xml</code>中的offline设为true。</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;offline&gt;</span>true<span class=nt>&lt;/offline&gt;</span>
</code></pre></td></tr></table></div></div><p>离线模式下的Maven是不会自动帮你从远处库下载项目依赖，该配置只建议在本地使用，因为如果pom中引入了新的依赖，此时Maven无法自动下载该依赖，会导致项目编译报错，如下：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-java data-lang=java><span class=n>Caused</span> <span class=n>by</span><span class=o>:</span> <span class=n>org</span><span class=o>.</span><span class=na>eclipse</span><span class=o>.</span><span class=na>aether</span><span class=o>.</span><span class=na>transfer</span><span class=o>.</span><span class=na>ArtifactNotFoundException</span><span class=o>:</span> <span class=n>Cannot</span> <span class=n>access</span> <span class=n>spring</span><span class=o>-</span><span class=n>releases</span> <span class=o>(</span><span class=n>https</span><span class=o>:</span><span class=c1>//repo.spring.io/libs-release) in offline mode and the artifact org.springframework.boot:spring-boot-loader-tools:jar:2.0.5.RELEASE has not been downloaded from it before.
</span></code></pre></td></tr></table></div></div><p>这种时候需要重新将offline节点改为false。</p><h2 id=optional标签>optional标签</h2><p>当不需要将某个依赖向外传递时，可以通过将optional标签设置为true来实现，比如当前项目使用的Lombok依赖不需要被其他项目所使用到：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span><span class=lnt>4
</span><span class=lnt>5
</span><span class=lnt>6
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-java data-lang=java><span class=o>&lt;</span><span class=n>dependency</span><span class=o>&gt;</span>
  <span class=o>&lt;</span><span class=n>groupId</span><span class=o>&gt;</span><span class=n>org</span><span class=o>.</span><span class=na>projectlombok</span><span class=o>&lt;/</span><span class=n>groupId</span><span class=o>&gt;</span>
  <span class=o>&lt;</span><span class=n>artifactId</span><span class=o>&gt;</span><span class=n>lombok</span><span class=o>&lt;/</span><span class=n>artifactId</span><span class=o>&gt;</span>
  <span class=o>&lt;</span><span class=n>version</span><span class=o>&gt;</span><span class=n>1</span><span class=o>.</span><span class=na>18</span><span class=o>.</span><span class=na>16</span><span class=o>&lt;/</span><span class=n>version</span><span class=o>&gt;</span>
  <span class=o>&lt;</span><span class=n>optional</span><span class=o>&gt;</span><span class=kc>true</span><span class=o>&lt;/</span><span class=n>optional</span><span class=o>&gt;</span>
<span class=o>&lt;/</span><span class=n>dependency</span><span class=o>&gt;</span>
</code></pre></td></tr></table></div></div><h2 id=编码gbk的不可映射字符>编码GBK的不可映射字符</h2><p>执行<code>mvn clean package</code>时报错：<code>编码GBK的不可映射字符</code>，该问题是因为字符集编码不同导致的，需要在pom中设置统一的编码：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt> 1
</span><span class=lnt> 2
</span><span class=lnt> 3
</span><span class=lnt> 4
</span><span class=lnt> 5
</span><span class=lnt> 6
</span><span class=lnt> 7
</span><span class=lnt> 8
</span><span class=lnt> 9
</span><span class=lnt>10
</span><span class=lnt>11
</span><span class=lnt>12
</span><span class=lnt>13
</span><span class=lnt>14
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;build&gt;</span>
	<span class=nt>&lt;finalName&gt;</span>demo<span class=nt>&lt;/finalName&gt;</span>
	<span class=nt>&lt;plugins&gt;</span>
		<span class=nt>&lt;plugin&gt;</span>  
			<span class=nt>&lt;groupId&gt;</span>org.apache.maven.plugins<span class=nt>&lt;/groupId&gt;</span>  
			<span class=nt>&lt;artifactId&gt;</span>maven-compiler-plugin<span class=nt>&lt;/artifactId&gt;</span>  
			<span class=nt>&lt;configuration&gt;</span>  
				<span class=nt>&lt;source&gt;</span>1.7<span class=nt>&lt;/source&gt;</span>  
				<span class=nt>&lt;target&gt;</span>1.7<span class=nt>&lt;/target&gt;</span>  
				<span class=nt>&lt;encoding&gt;</span>utf8<span class=nt>&lt;/encoding&gt;</span>    
			<span class=nt>&lt;/configuration&gt;</span>  
		<span class=nt>&lt;/plugin&gt;</span>
	<span class=nt>&lt;/plugins&gt;</span>
<span class=nt>&lt;/build&gt;</span>
</code></pre></td></tr></table></div></div><p>这里的source和target的1.7指的是编译时使用jdk1.7版本；而encoding指定了utf8编码（我测试了下，发现写utf-8也可以）。</p><h2 id=打war包的方式>打war包的方式</h2><p>首先要了解Maven的流程：</p><ul><li><code>mvn clean</code>：清除<code>target</code>目录</li><li><code>mvn compile</code>：编译文件</li><li><code>mvn package</code>：打包项目</li><li><code>mvn install</code>：把打包后的项目安装到本地仓库，包含了compile和package</li><li><code>mvn deploy</code>：把打包后的项目上传到远程仓库（比如自行搭建的私服），包含了install</li></ul><p>关于打war包，有多种方式，如下：</p><ul><li>使用Maven本身的打包方式，把<code>mvn packaging</code>设为<code>war</code>，即可使用package命令打成war包。</li><li>使用maven的war命令：<code>mvn war:exploded</code>或者<code>mvn war:war</code>，后一个命令会打包出一个war包以及war包解压后的目录文件，前一个命令只会打包出war包解压后的目录文件。
* 使用<code>tomcat7</code>插件命令打包：<code>mvn tomcat7:exec-war</code>或者<code>mvn tomcat7:exec-war-only</code>，如下：</li></ul><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span><span class=lnt>4
</span><span class=lnt>5
</span><span class=lnt>6
</span><span class=lnt>7
</span><span class=lnt>8
</span><span class=lnt>9
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;build&gt;</span>
    <span class=nt>&lt;plugins&gt;</span>
        <span class=nt>&lt;plugin&gt;</span>
            <span class=nt>&lt;groupId&gt;</span>org.apache.tomcat.maven<span class=nt>&lt;/groupId&gt;</span>
            <span class=nt>&lt;artifactId&gt;</span>tomcat7-maven-plugin<span class=nt>&lt;/artifactId&gt;</span>
            <span class=nt>&lt;version&gt;</span>2.2<span class=nt>&lt;/version&gt;</span>
        <span class=nt>&lt;/plugin&gt;</span>
    <span class=nt>&lt;/plugins&gt;</span>
<span class=nt>&lt;/build&gt;</span>
</code></pre></td></tr></table></div></div><p><code>tomcat7</code>插件支持以下命令：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt> 1
</span><span class=lnt> 2
</span><span class=lnt> 3
</span><span class=lnt> 4
</span><span class=lnt> 5
</span><span class=lnt> 6
</span><span class=lnt> 7
</span><span class=lnt> 8
</span><span class=lnt> 9
</span><span class=lnt>10
</span><span class=lnt>11
</span><span class=lnt>12
</span><span class=lnt>13
</span><span class=lnt>14
</span><span class=lnt>15
</span><span class=lnt>16
</span><span class=lnt>17
</span><span class=lnt>18
</span><span class=lnt>19
</span><span class=lnt>20
</span><span class=lnt>21
</span><span class=lnt>22
</span><span class=lnt>23
</span><span class=lnt>24
</span><span class=lnt>25
</span><span class=lnt>26
</span><span class=lnt>27
</span><span class=lnt>28
</span><span class=lnt>29
</span><span class=lnt>30
</span><span class=lnt>31
</span><span class=lnt>32
</span><span class=lnt>33
</span><span class=lnt>34
</span><span class=lnt>35
</span><span class=lnt>36
</span><span class=lnt>37
</span><span class=lnt>38
</span><span class=lnt>39
</span><span class=lnt>40
</span><span class=lnt>41
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-fallback data-lang=fallback>// 查看帮助信息
tomcat7:help

// 把WAR部署到Tomcat
tomcat7:deploy

// 把WAR部署到Tomcat，但是不管理包的生命周期
tomcat7:deploy-only

// 重新部署WAR到Tomcat
tomcat7:redeploy

// 重新部署WAR到Tomcat，但是不管理包的生命周期
tomcat7:redeploy-only

// 从Tomcat中卸载WAR
tomcat7:undeploy

// 使用内嵌的Tomcat服务把当前应用作为动态web应用运行
tomcat7:run

// 使用内嵌的Tomcat服务运行当前应用的打包文件war
tomcat7:run-war

// 使用内嵌的Tomcat服务运行当前应用的打包文件war，但是不管理包的生命周期
tomcat7:run-war-only

// 创建一个可执行的jar文件，其中包含了Apache Tomcat，只要执行java -jar xxx.jar即可运行web应用
tomcat7:exec-war

// 创建一个可执行的jar文件，但是不管理包的生命周期
tomcat7:exec-war-only

// 关闭所有的可执行的服务
tomcat7:shutdown

// 创建一个可执行的war文件
tomcat7:standalone-war

// 创建一个可执行的war文件
tomcat7:standalone-war-only
</code></pre></td></tr></table></div></div><p>最后两个命令在<code>mvn tomcat7:help</code>中的解释是一模一样的，暂时不知道和<code>exec-war</code>有何区别。</p><h2 id=mvn-clean-package的执行顺序><code>mvn clean package</code>的执行顺序</h2><ol><li>使用清理插件<code>maven-clean-plugin</code>清理已有的target目录（使用了clean才有这一步）</li><li>使用资源插件<code>maven-resources-plugin</code>处理资源文件</li><li>使用编译插件<code>maven-compiler-plugin</code>编译所有源文件生成class文件到target/classes目录下</li><li>使用资源插件<code>maven-resources-plugin</code>处理测试用的资源文件</li><li>使用编译插件<code>maven-compiler-plugin</code>编译测试用的源码正常class文件到target/test-classes目录下</li><li>使用测试插件<code>maven-surefire-plugin</code>运行测试用例</li><li>使用打包插件<code>maven-jar-plugin</code>对编译后生成的文件进行打包，包名和配置的finalName一致，打包后的文件存放在target目录下</li></ol><p>不管是compile、package还是install等，前三个步骤都是必不可少的。</p><h2 id=设置下载源码和文档>设置下载源码和文档</h2><p>方法很多，这里说下3种。</p><h3 id=使用maven命令>使用Maven命令</h3><p>在项目根目录下执行：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-bat data-lang=bat>mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
</code></pre></td></tr></table></div></div><h3 id=修改配置文件进行全局配置>修改配置文件进行全局配置</h3><p>打开当前用户目录下的全局配置文件<code>/.m2/settings.xml</code>，添加如下配置：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt> 1
</span><span class=lnt> 2
</span><span class=lnt> 3
</span><span class=lnt> 4
</span><span class=lnt> 5
</span><span class=lnt> 6
</span><span class=lnt> 7
</span><span class=lnt> 8
</span><span class=lnt> 9
</span><span class=lnt>10
</span><span class=lnt>11
</span><span class=lnt>12
</span><span class=lnt>13
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;profiles&gt;</span>    
	<span class=nt>&lt;profile&gt;</span>    
	    <span class=nt>&lt;id&gt;</span>downloadSources<span class=nt>&lt;/id&gt;</span>    
	    <span class=nt>&lt;properties&gt;</span>    
	        <span class=nt>&lt;downloadSources&gt;</span>true<span class=nt>&lt;/downloadSources&gt;</span>    
	        <span class=nt>&lt;downloadJavadocs&gt;</span>true<span class=nt>&lt;/downloadJavadocs&gt;</span>               
	    <span class=nt>&lt;/properties&gt;</span>    
	<span class=nt>&lt;/profile&gt;</span>    
<span class=nt>&lt;/profiles&gt;</span>    
    
<span class=nt>&lt;activeProfiles&gt;</span>    
	<span class=nt>&lt;activeProfile&gt;</span>downloadSources<span class=nt>&lt;/activeProfile&gt;</span>    
<span class=nt>&lt;/activeProfiles&gt;</span>    
</code></pre></td></tr></table></div></div><h3 id=在ide工具中配置>在IDE工具中配置</h3><p>可以在IDE工具，诸如Eclipse、idea等中修改Maven插件的一些配置，在Eclipse中配置如下：</p><p><code>Window</code> -> <code>Preferences</code> -> <code>Maven</code> -> 勾选<code>Download Artifact Sources</code>和<code>Download Artifact JavaDoc</code></p><h2 id=maven聚合工程怎么变回普通的maven工程>Maven聚合工程怎么变回普通的Maven工程</h2><p>Maven聚合工程的父工程的packaging是pom，如果我们将其改为jar，会立刻报错：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-java data-lang=java><span class=n>Project</span> <span class=n>build</span> <span class=n>error</span><span class=o>:</span> <span class=err>&#39;</span><span class=n>packaging</span><span class=err>&#39;</span> <span class=n>with</span> <span class=n>value</span> <span class=err>&#39;</span><span class=n>jar</span><span class=err>&#39;</span> <span class=n>is</span> <span class=n>invalid</span><span class=o>.</span> <span class=n>Aggregator</span> <span class=n>projects</span> <span class=n>require</span> <span class=err>&#39;</span><span class=n>pom</span><span class=err>&#39;</span> <span class=n>as</span> <span class=n>packaging</span><span class=o>.</span>
</code></pre></td></tr></table></div></div><p>对于聚合工程来说，所有的子工程会被放置到父工程的目录下，然后在父工程的pom文件里会有如下的节点：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;modules&gt;</span>
    <span class=nt>&lt;module&gt;</span>test-child<span class=nt>&lt;/module&gt;</span>
<span class=nt>&lt;/modules&gt;</span>
</code></pre></td></tr></table></div></div><p>这些modules节点正是引用了父工程pom文件的子工程。</p><h3 id=解决方法>解决方法</h3><p>将父工程的modules节点全部去掉，注释掉也行，再将packaging的值从pom改成jar或者war，接着保存，修改成功。</p><p>虽然修改成功了，但是去父工程的目录下 ，你会发现那些子工程依然存在着。不过这些工程已经很父工程没有关系了，因为父工程已经不再是聚合工程了，可以将这些子工程移除掉。</p><h2 id=javalangstackoverflowerror><code>java.lang.StackOverflowError</code></h2><p>服务器上的Jenkins在集成项目时报错如下：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span><span class=lnt>4
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-java data-lang=java><span class=n>error</span> <span class=n>compiling</span><span class=o>:</span> <span class=n>java</span><span class=o>.</span><span class=na>lang</span><span class=o>.</span><span class=na>StackOverflowError</span> <span class=o>-&gt;</span> <span class=o>[</span><span class=n>Help</span> <span class=n>1</span><span class=o>]</span>
<span class=o>[</span><span class=n>ERROR</span><span class=o>]</span> 
<span class=o>[</span><span class=n>ERROR</span><span class=o>]</span> <span class=n>To</span> <span class=n>see</span> <span class=n>the</span> <span class=n>full</span> <span class=n>stack</span> <span class=n>trace</span> <span class=n>of</span> <span class=n>the</span> <span class=n>errors</span><span class=o>,</span> <span class=n>re</span><span class=o>-</span><span class=n>run</span> <span class=n>Maven</span> <span class=n>with</span> <span class=n>the</span> <span class=o>-</span><span class=n>e</span> <span class=k>switch</span><span class=o>.</span>
<span class=o>[</span><span class=n>ERROR</span><span class=o>]</span> <span class=n>Re</span><span class=o>-</span><span class=n>run</span> <span class=n>Maven</span> <span class=n>using</span> <span class=n>the</span> <span class=o>-</span><span class=n>X</span> <span class=k>switch</span> <span class=n>to</span> <span class=n>enable</span> <span class=n>full</span> <span class=n>debug</span> <span class=n>logging</span><span class=o>.</span>
</code></pre></td></tr></table></div></div><p>错误很明显，堆栈溢出，要么是jvm设置的线程栈太小，要么是代码有问题。而服务器每天晚上都会自动集成，jvm参数也不会有人去改过，很明显是最近提交的代码有问题。</p><p>审查了代码，发现是某个测试类中有段代码里调用了一个API，该API又调用了四百多个API。这个API的目的是检测pojo里的字段是否和数据库的字段匹配，一个字段对应一个API，总共有四百多字段。Jenkins在跑单元测试跑到这里就堆栈溢出了。</p><p>毕竟是测试类的代码，改动时逻辑照旧，只不过不继续在一个API去直接调用四百个API，而是将其分成两个新的方法，每个方法各自调用两百个API，然后原本的API调用新增的两个方法。</p><p>之后提交代码，重新让Jenkins集成代码，发现不再报错。</p><p>当然了，也可以直接在启动脚本里简单粗暴调大线程栈大小：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-bat data-lang=bat><span class=k>set</span> <span class=nv>MAVEN_OPTS</span><span class=p>=</span>-Xss4096k
或者
<span class=k>set</span> <span class=nv>MAVEN_OPTS</span><span class=p>=</span>-Xss2m
</code></pre></td></tr></table></div></div><p>这里顺便贴一下项目脚本原本设置的参数：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span><span class=lnt>4
</span><span class=lnt>5
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-bat data-lang=bat><span class=k>echo</span> off
<span class=k>setlocal</span>
<span class=k>set</span> <span class=nv>MAVEN_DEBUG_OPTS</span><span class=p>=</span>-Duser.timezone=GMT+8 -Xdebug -Xmx4096M -XX:PermSize=128M -XX:MaxPermSize=512M -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8088,server=y,suspend=n
mvn spring-boot:run
<span class=k>endlocal</span>
</code></pre></td></tr></table></div></div><h2 id=无法下载217js7版本的itext依赖>无法下载2.1.7.js7版本的itext依赖</h2><p>编译项目时报错如下：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-java data-lang=java><span class=n>Failed</span> <span class=n>to</span> <span class=n>collect</span> <span class=n>dependencies</span> <span class=n>at</span> <span class=n>net</span><span class=o>.</span><span class=na>sf</span><span class=o>.</span><span class=na>jasperreports</span><span class=o>:</span><span class=n>jasperreports</span><span class=o>:</span><span class=n>jar</span><span class=o>:</span><span class=n>6</span><span class=o>.</span><span class=na>10</span><span class=o>.</span><span class=na>0</span>
<span class=o>-&gt;</span> <span class=n>com</span><span class=o>.</span><span class=na>lowagie</span><span class=o>:</span><span class=n>itext</span><span class=o>:</span><span class=n>jar</span><span class=o>:</span><span class=n>2</span><span class=o>.</span><span class=na>1</span><span class=o>.</span><span class=na>7</span><span class=o>.</span><span class=na>js7</span><span class=o>:</span> <span class=n>Failed</span> <span class=n>to</span> <span class=n>read</span> <span class=n>artifact</span> <span class=n>descriptor</span> <span class=k>for</span> <span class=n>com</span><span class=o>.</span><span class=na>lowagie</span><span class=o>:</span><span class=n>itext</span><span class=o>:</span><span class=n>jar</span><span class=o>:</span><span class=n>2</span><span class=o>.</span><span class=na>1</span><span class=o>.</span><span class=na>7</span><span class=o>.</span><span class=na>js7</span><span class=o>:</span> 
<span class=n>Could</span> <span class=n>not</span> <span class=n>transfer</span> <span class=n>artifact</span> <span class=n>com</span><span class=o>.</span><span class=na>lowagie</span><span class=o>:</span><span class=n>itext</span><span class=o>:</span><span class=n>pom</span><span class=o>:</span><span class=n>2</span><span class=o>.</span><span class=na>1</span><span class=o>.</span><span class=na>7</span><span class=o>.</span><span class=na>js7</span>
</code></pre></td></tr></table></div></div><p>一开始以为是网络不好连接不上远程库，或者远程库没有该jar包，后来发现在Maven中央仓库里也没找到<code>2.1.7.js7</code>版本的<code>itext</code>依赖。在Stack Overflow上查询后发现有不少人遇到同样的问题，都是由于使用了某个版本的<code>jasperreports</code>，最终导致了该错误。</p><p>由于在jasperreports的pom文件里指定了<code>2.1.7.js7</code>版本的<code>itext</code>依赖，而目前的Maven中央仓库或其他镜像仓库里是不存在这种带有<code>js7</code>等后缀版本。该版本是jasperreports为了修复一些bug而打上了补丁的版本，但是并没有release到中央库里，不过这些bug在更高版本里也被修复了，可以使用更高版本的itext来避免这些bug。</p><h3 id=解决方法-1>解决方法</h3><p>排除jasperreports中的itext依赖并自行指定版本，pom如下：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt> 1
</span><span class=lnt> 2
</span><span class=lnt> 3
</span><span class=lnt> 4
</span><span class=lnt> 5
</span><span class=lnt> 6
</span><span class=lnt> 7
</span><span class=lnt> 8
</span><span class=lnt> 9
</span><span class=lnt>10
</span><span class=lnt>11
</span><span class=lnt>12
</span><span class=lnt>13
</span><span class=lnt>14
</span><span class=lnt>15
</span><span class=lnt>16
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-fallback data-lang=fallback>&lt;dependency&gt;
    &lt;groupId&gt;net.sf.jasperreports&lt;/groupId&gt;
    &lt;artifactId&gt;jasperreports&lt;/artifactId&gt;
    &lt;version&gt;6.10.0&lt;/version&gt;
    &lt;exclusions&gt;
        &lt;exclusion&gt;
            &lt;groupId&gt;com.lowagie&lt;/groupId&gt;
            &lt;artifactId&gt;itext&lt;/artifactId&gt;
        &lt;/exclusion&gt;
    &lt;/exclusions&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
  &lt;groupId&gt;com.lowagie&lt;/groupId&gt;
  &lt;artifactId&gt;itext&lt;/artifactId&gt;
  &lt;version&gt;2.1.7&lt;/version&gt;
&lt;/dependency&gt;
</code></pre></td></tr></table></div></div><p>这里的itext版本根据自身实际情况指定，目前itext已停止维护，并从4.2.2之后的版本开始从<code>com.lowagie.itext</code>迁移到<code>com.itextpdf.itextpdf</code>，有需要的话可以使用更高版本的itextpdf依赖，pom如下：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt> 1
</span><span class=lnt> 2
</span><span class=lnt> 3
</span><span class=lnt> 4
</span><span class=lnt> 5
</span><span class=lnt> 6
</span><span class=lnt> 7
</span><span class=lnt> 8
</span><span class=lnt> 9
</span><span class=lnt>10
</span><span class=lnt>11
</span><span class=lnt>12
</span><span class=lnt>13
</span><span class=lnt>14
</span><span class=lnt>15
</span><span class=lnt>16
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-fallback data-lang=fallback>&lt;dependency&gt;
    &lt;groupId&gt;jasperreports&lt;/groupId&gt;
    &lt;artifactId&gt;jasperreports&lt;/artifactId&gt;
    &lt;version&gt;6.10.0&lt;/version&gt; &lt;!--(or higher)--&gt;
    &lt;exclusions&gt;
        &lt;exclusion&gt;
            &lt;groupId&gt;com.lowagie&lt;/groupId&gt;
            &lt;artifactId&gt;itext&lt;/artifactId&gt;
        &lt;/exclusion&gt;
    &lt;/exclusions&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
    &lt;groupId&gt;com.itextpdf&lt;/groupId&gt;
    &lt;artifactId&gt;itextpdf&lt;/artifactId&gt;
    &lt;version&gt;5.5.13&lt;/version&gt; &lt;!--(or higher)--&gt;
&lt;/dependency&gt;
</code></pre></td></tr></table></div></div><h2 id=javaawtfontformatexception-bad-table-tag><code>java.awt.FontFormatException: bad table, tag=</code></h2><p>Java加载外部字体时报错<code>FontFormatException</code>，Maven在编译项目时使用<code>-X</code>开启debug模式同样可以看到该异常。原因是使用了<code>resource</code>插件的<code>filtering</code>功能，<code>filtering</code>为<code>true</code>时可以使用系统变量或者启动参数来替换资源文件的占位符<code>${}</code>的值。但也会导致Maven打包时对资源文件重新进行编译，而这些资源文件自身有着特定的编码，被Maven重新编码后文件损坏，于是就会触发该异常。</p><p>处理方式很简单，不再过滤特定的资源文件，如字体、excel等，避免对其重新编码。下面是demo：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt> 1
</span><span class=lnt> 2
</span><span class=lnt> 3
</span><span class=lnt> 4
</span><span class=lnt> 5
</span><span class=lnt> 6
</span><span class=lnt> 7
</span><span class=lnt> 8
</span><span class=lnt> 9
</span><span class=lnt>10
</span><span class=lnt>11
</span><span class=lnt>12
</span><span class=lnt>13
</span><span class=lnt>14
</span><span class=lnt>15
</span><span class=lnt>16
</span><span class=lnt>17
</span><span class=lnt>18
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;plugins&gt;</span>
    <span class=nt>&lt;plugin&gt;</span>
        <span class=nt>&lt;groupId&gt;</span>org.apache.maven.plugins<span class=nt>&lt;/groupId&gt;</span>
        <span class=nt>&lt;artifactId&gt;</span>maven-resources-plugin<span class=nt>&lt;/artifactId&gt;</span>
        <span class=nt>&lt;configuration&gt;</span>
            <span class=c>&lt;!-- 过滤后缀不需要转码的文件后缀名.crt/.ttf--&gt;</span>
            <span class=nt>&lt;nonFilteredFileExtensions&gt;</span>
                <span class=nt>&lt;nonFilteredFileExtension&gt;</span>ttf<span class=nt>&lt;/nonFilteredFileExtension&gt;</span>
                <span class=nt>&lt;nonFilteredFileExtension&gt;</span>xlsx<span class=nt>&lt;/nonFilteredFileExtension&gt;</span>
                <span class=nt>&lt;nonFilteredFileExtension&gt;</span>xls<span class=nt>&lt;/nonFilteredFileExtension&gt;</span>
                <span class=nt>&lt;nonFilteredFileExtension&gt;</span>zip<span class=nt>&lt;/nonFilteredFileExtension&gt;</span>
                <span class=nt>&lt;nonFilteredFileExtension&gt;</span>cer<span class=nt>&lt;/nonFilteredFileExtension&gt;</span>
                <span class=nt>&lt;nonFilteredFileExtension&gt;</span>pfx<span class=nt>&lt;/nonFilteredFileExtension&gt;</span>
                <span class=nt>&lt;nonFilteredFileExtension&gt;</span>py<span class=nt>&lt;/nonFilteredFileExtension&gt;</span>
            <span class=nt>&lt;/nonFilteredFileExtensions&gt;</span>
        <span class=nt>&lt;/configuration&gt;</span>
    <span class=nt>&lt;/plugin&gt;</span>
<span class=nt>&lt;/plugins&gt;</span>
</code></pre></td></tr></table></div></div><p>这个<code>nonFilteredFileExtensions</code>标签和<code>exclude</code>是不同的，前者依然会打包文件，只是不对其进行重新编译；后者是在打包时直接排除对应的文件。</p><p><code>include</code>是指定打包时需要哪些文件，但<code>include</code>和<code>exclude</code>的配置冲突时，以后者为准。</p><h2 id=引入本地jar包>引入本地jar包</h2><p>两种方式，一种是把jar包安装到本地仓库后再引入；一种是直接用<code>systemPath</code>直接引入一个外部的jar包。如果只是本地开发，可以用前一种方式；如果是协同开发，个人更倾向于后一种方式。</p><h3 id=方式一安装到本地仓库>方式一：安装到本地仓库</h3><p>下面是将jar包安装到本地的命令：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-bat data-lang=bat>mvn install:install-file -Dfile=D:\lib\test.jar -DgroupId=com.test -DartifactId=test -Dversion=0.0.1 -Dpackaging=jar
</code></pre></td></tr></table></div></div><p><code>-Dfile</code>指明需要被安装的jar包路径。</p><p><code>-DgroupId</code>和<code>-DartifactId</code>指定jar包的唯一依赖路径，注意别跟其他的本地依赖路径冲突就行。</p><p><code>-Dversion</code>指定依赖的版本。</p><p><code>-Dpackaging</code>指明打包方式。</p><p>安装到本地仓库后可以像普通依赖那样引入：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span><span class=lnt>4
</span><span class=lnt>5
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;dependency&gt;</span>
    <span class=nt>&lt;groupId&gt;</span>com.test<span class=nt>&lt;/groupId&gt;</span>
    <span class=nt>&lt;artifactId&gt;</span>test<span class=nt>&lt;/artifactId&gt;</span>
    <span class=nt>&lt;version&gt;</span>0.0.1<span class=nt>&lt;/version&gt;</span>
<span class=nt>&lt;/dependency&gt;</span>
</code></pre></td></tr></table></div></div><h3 id=方式二systempath直接引入>方式二：<code>systemPath</code>直接引入</h3><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
</span><span class=lnt>4
</span><span class=lnt>5
</span><span class=lnt>6
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=nt>&lt;dependency&gt;</span>
    <span class=nt>&lt;groupId&gt;</span>com.test<span class=nt>&lt;/groupId&gt;</span>
    <span class=nt>&lt;artifactId&gt;</span>test<span class=nt>&lt;/artifactId&gt;</span>
    <span class=nt>&lt;scope&gt;</span>system<span class=nt>&lt;/scope&gt;</span>
    <span class=nt>&lt;systemPath&gt;</span>${basedir}/src/main/resources/lib/test.jar<span class=nt>&lt;/systemPath&gt;</span>
<span class=nt>&lt;/dependency&gt;</span>
</code></pre></td></tr></table></div></div><p><code>${basedir}</code>是Maven的内置属性，代表项目根目录。</p><h2 id=压缩jscss代码>压缩js+css代码</h2><p>借助<code>yuicompressor</code>插件来完成：</p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code><span class=lnt> 1
</span><span class=lnt> 2
</span><span class=lnt> 3
</span><span class=lnt> 4
</span><span class=lnt> 5
</span><span class=lnt> 6
</span><span class=lnt> 7
</span><span class=lnt> 8
</span><span class=lnt> 9
</span><span class=lnt>10
</span><span class=lnt>11
</span><span class=lnt>12
</span><span class=lnt>13
</span><span class=lnt>14
</span><span class=lnt>15
</span><span class=lnt>16
</span><span class=lnt>17
</span><span class=lnt>18
</span><span class=lnt>19
</span><span class=lnt>20
</span><span class=lnt>21
</span><span class=lnt>22
</span><span class=lnt>23
</span><span class=lnt>24
</span><span class=lnt>25
</span><span class=lnt>26
</span><span class=lnt>27
</span><span class=lnt>28
</span><span class=lnt>29
</span><span class=lnt>30
</span><span class=lnt>31
</span><span class=lnt>32
</span><span class=lnt>33
</span><span class=lnt>34
</span><span class=lnt>35
</span><span class=lnt>36
</span><span class=lnt>37
</span><span class=lnt>38
</span><span class=lnt>39
</span><span class=lnt>40
</span><span class=lnt>41
</span><span class=lnt>42
</span><span class=lnt>43
</span><span class=lnt>44
</span><span class=lnt>45
</span><span class=lnt>46
</span><span class=lnt>47
</span><span class=lnt>48
</span><span class=lnt>49
</span><span class=lnt>50
</span><span class=lnt>51
</span><span class=lnt>52
</span><span class=lnt>53
</span><span class=lnt>54
</span><span class=lnt>55
</span><span class=lnt>56
</span><span class=lnt>57
</span><span class=lnt>58
</span><span class=lnt>59
</span><span class=lnt>60
</span><span class=lnt>61
</span><span class=lnt>62
</span><span class=lnt>63
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-xml data-lang=xml><span class=c>&lt;!-- Maven全局属性，统一编码 --&gt;</span>
<span class=nt>&lt;properties&gt;</span>
 <span class=nt>&lt;project.build.sourceEncoding&gt;</span>UTF-8<span class=nt>&lt;/project.build.sourceEncoding&gt;</span>
<span class=nt>&lt;/properties&gt;</span>
<span class=c>&lt;!-- 构建相关配置  --&gt;</span>
<span class=nt>&lt;build&gt;</span>
 <span class=c>&lt;!-- maven插件配置 --&gt;</span>
 <span class=nt>&lt;plugins&gt;</span>
   <span class=nt>&lt;plugin&gt;</span>
     <span class=c>&lt;!-- YUI Compressor Maven压缩插件 --&gt;</span>
     <span class=nt>&lt;groupId&gt;</span>net.alchim31.maven<span class=nt>&lt;/groupId&gt;</span>
     <span class=nt>&lt;artifactId&gt;</span>yuicompressor-maven-plugin<span class=nt>&lt;/artifactId&gt;</span>
     <span class=nt>&lt;version&gt;</span>1.3.0<span class=nt>&lt;/version&gt;</span>
     <span class=nt>&lt;configuration&gt;</span>
       <span class=c>&lt;!-- 读取js,css文件采用UTF-8编码 --&gt;</span>
       <span class=nt>&lt;encoding&gt;</span>UTF-8<span class=nt>&lt;/encoding&gt;</span>
       <span class=c>&lt;!-- 不显示js可能的错误 --&gt;</span>
       <span class=nt>&lt;jswarn&gt;</span>false<span class=nt>&lt;/jswarn&gt;</span>
       <span class=c>&lt;!-- 若存在已压缩的文件，会先对比源文件是否有改动。有改动便压缩，无改动就不压缩 --&gt;</span>
       <span class=nt>&lt;force&gt;</span>false<span class=nt>&lt;/force&gt;</span>
       <span class=c>&lt;!-- 在指定的列号后插入新行 --&gt;</span>
       <span class=nt>&lt;linebreakpos&gt;</span>-1<span class=nt>&lt;/linebreakpos&gt;</span>
       <span class=c>&lt;!-- 压缩之前先执行聚合文件操作 --&gt;</span>
       <span class=nt>&lt;preProcessAggregates&gt;</span>true<span class=nt>&lt;/preProcessAggregates&gt;</span>
       <span class=c>&lt;!-- 压缩后保存文件后缀 --&gt;</span>
       <span class=nt>&lt;suffix&gt;</span>.min<span class=nt>&lt;/suffix&gt;</span>
       <span class=c>&lt;!-- 源目录，即需压缩的根目录 --&gt;</span>
       <span class=nt>&lt;sourceDirectory&gt;</span>${basedir}/mobile<span class=nt>&lt;/sourceDirectory&gt;</span>
       <span class=c>&lt;!-- 压缩js和css文件 --&gt;</span>
       <span class=nt>&lt;includes&gt;</span>
         <span class=nt>&lt;include&gt;</span>**/*.js<span class=nt>&lt;/include&gt;</span>
         <span class=nt>&lt;include&gt;</span>**/*.css<span class=nt>&lt;/include&gt;</span>
       <span class=nt>&lt;/includes&gt;</span>
       <span class=c>&lt;!-- 以下目录和文件不会被压缩 --&gt;</span>
       <span class=nt>&lt;excludes&gt;</span>
         <span class=nt>&lt;exclude&gt;</span>**/*.min.js<span class=nt>&lt;/exclude&gt;</span>
         <span class=nt>&lt;exclude&gt;</span>**/*.min.css<span class=nt>&lt;/exclude&gt;</span>
         <span class=nt>&lt;exclude&gt;</span>scripts/data/*.js<span class=nt>&lt;/exclude&gt;</span>
       <span class=nt>&lt;/excludes&gt;</span>
       <span class=c>&lt;!-- 压缩后输出文件目录 --&gt;</span>
       <span class=nt>&lt;outputDirectory&gt;</span>${basedir}/mobile<span class=nt>&lt;/outputDirectory&gt;</span>
       <span class=c>&lt;!-- 聚合文件 --&gt;</span>
       <span class=nt>&lt;aggregations&gt;</span>
         <span class=nt>&lt;aggregation&gt;</span>
           <span class=c>&lt;!-- 合并每一个文件后插入一新行 --&gt;</span>
           <span class=nt>&lt;insertNewLine&gt;</span>true<span class=nt>&lt;/insertNewLine&gt;</span>
           <span class=c>&lt;!-- 需合并文件的根文件夹 --&gt;</span>
           <span class=nt>&lt;inputDir&gt;</span>${basedir}/mobile/scripts<span class=nt>&lt;/inputDir&gt;</span>
           <span class=c>&lt;!-- 最终合并的输出文件 --&gt;</span>
           <span class=nt>&lt;output&gt;</span>${basedir}/mobile/scripts/app/app.js<span class=nt>&lt;/output&gt;</span>
           <span class=c>&lt;!-- 把以下js文件合并成一个js文件，是按顺序合并的 --&gt;</span>
           <span class=nt>&lt;includes&gt;</span>
             <span class=nt>&lt;include&gt;</span>app/core.js<span class=nt>&lt;/include&gt;</span>
             <span class=nt>&lt;include&gt;</span>app/mlmanager.js<span class=nt>&lt;/include&gt;</span>
             <span class=nt>&lt;include&gt;</span>app/tmpl.js<span class=nt>&lt;/include&gt;</span>
             <span class=nt>&lt;include&gt;</span>app/ui.js<span class=nt>&lt;/include&gt;</span>
           <span class=nt>&lt;/includes&gt;</span>
         <span class=nt>&lt;/aggregation&gt;</span>
       <span class=nt>&lt;/aggregations&gt;</span>
     <span class=nt>&lt;/configuration&gt;</span>
   <span class=nt>&lt;/plugin&gt;</span>
 <span class=nt>&lt;/plugins&gt;</span>
<span class=nt>&lt;/build&gt;</span>
</code></pre></td></tr></table></div></div><h2 id=跳过测试案例>跳过测试案例</h2><p>有两种方式，一个是启动时添加参数：<code>-DskipTests</code>；一种是添加参数<code>-Dmaven.test.skip=true</code>。</p><p>前者不执行测试用例，但是会编译测试类到<code>target/test-classes</code>目录。</p><p>后者既不执行测试用例，也不编译测试类。</p><h2 id=参考链接>参考链接</h2><ul><li><a href=https://blog.csdn.net/wangb_java/article/details/55653122 target=_blank rel="noopener noreffer">maven(八)，阿里云国内镜像，提高jar包下载速度</a></li><li><a href=https://www.cnblogs.com/frankyou/p/6062179.html target=_blank rel="noopener noreffer">Maven命令行使用：mvn clean package（打包）</a></li><li><a href=http://blog.csdn.net/zyf_balance/article/details/50910521 target=_blank rel="noopener noreffer">maven 编码GBK的不可映射字符</a></li><li><a href=https://juejin.im/post/5ae4218a6fb9a07ac90cf586 target=_blank rel="noopener noreffer">Maven执行install命令出现Exception in thread &ldquo;main&rdquo; java.lang.StackOverflowError</a></li><li><a href=https://lisheng0305.blog.csdn.net/article/details/115235477 target=_blank rel="noopener noreffer">java读取字体文件tff，报错java.awt.FontFormatException: bad table, tag=一串数字</a></li><li><a href=https://blog.csdn.net/u012643122/article/details/95030849 target=_blank rel="noopener noreffer">人生苦短，你需要maven，resource、filter、include、exclude简单说明及使用</a></li><li><a href=https://blog.csdn.net/ljxbbss/article/details/78060636 target=_blank rel="noopener noreffer">maven设置下载源码</a></li><li><a href=https://stackoverflow.com/questions/31314373/dependency-error-in-jasper-reports-from-itext target=_blank rel="noopener noreffer">Dependency error in jasper-reports from itext</a></li><li><a href=https://mvnrepository.com/artifact/com.lowagie/itext target=_blank rel="noopener noreffer">IText, A Free Java PDF Library</a></li><li><a href=https://www.cnblogs.com/guojuncheng/p/9149151.html target=_blank rel="noopener noreffer">在maven中引入本地jar包的方法</a></li><li><a href=https://www.cnblogs.com/lorence/articles/2750001.html target=_blank rel="noopener noreffer">maven实现JS+CSS自动压缩</a></li><li><a href=https://www.cnblogs.com/qlqwjy/p/8231032.html target=_blank rel="noopener noreffer">eclipse maven 打war包的几种方式</a></li><li><a href=https://blog.csdn.net/qq_34017326/article/details/78591632 target=_blank rel="noopener noreffer">Maven之Tomcat</a></li><li><a href=https://www.cnblogs.com/wangcp-2014/p/6211439.html target=_blank rel="noopener noreffer">Maven中-DskipTests和-Dmaven.test.skip=true的区别</a></li></ul><div class="details admonition note open"><div class="details-summary admonition-title"><i class="icon fas fa-pencil-alt fa-fwnote"></i>注意<i class="details-icon fas fa-angle-right fa-fw"></i></div><div class=details-content><div class=admonition-content>本文最后更新于 <span class=timeago datetime=2021-09-07T23:19:56 title="September 7, 2021">September 7, 2021</span>，文中内容可能已过时，请谨慎使用。</div></div></div><div class=post-reward><input type=checkbox name=reward id=reward hidden>
<label class=reward-button for=reward>赞赏支持</label><div class=qr-code><label class=qr-code-image for=reward><img class=image src=https://cdn.jsdelivr.net/gh/lewky/lewky.github.io@master/images/common/wechat.png>
<span>微信打赏</span></label>
<label class=qr-code-image for=reward><img class=image src=https://cdn.jsdelivr.net/gh/lewky/lewky.github.io@master/images/common/alipay.png>
<span>支付宝打赏</span></label></div></div></div><div class=post-footer id=post-footer><div class=post-info><div class=post-info-line><div class=post-info-mod><span>更新于 2021-09-07</span></div><div class=post-info-license><span><a rel="license external nofollow noopener noreffer" href=https://creativecommons.org/licenses/by-nc/4.0/ target=_blank>CC BY-NC 4.0</a></span></div></div><div class=post-info-line><div class=post-info-md><span><a class=link-to-markdown href=/posts/maven-issues/index.md target=_blank>阅读原始文档</a></span></div><div class=post-info-share><span><a href=javascript:void(0); title="分享到 Twitter" data-sharer=twitter data-url=https://lewky.cn/posts/maven-issues/ data-title=Maven问题汇总 data-hashtags=Maven,工作记录><i class="fab fa-twitter fa-fw"></i></a><a href=javascript:void(0); title="分享到 Facebook" data-sharer=facebook data-url=https://lewky.cn/posts/maven-issues/ data-hashtag=Maven><i class="fab fa-facebook-square fa-fw"></i></a><a href=javascript:void(0); title="分享到 Hacker News" data-sharer=hackernews data-url=https://lewky.cn/posts/maven-issues/ data-title=Maven问题汇总><i class="fab fa-hacker-news fa-fw"></i></a><a href=javascript:void(0); title="分享到 Line" data-sharer=line data-url=https://lewky.cn/posts/maven-issues/ data-title=Maven问题汇总><i data-svg-src=https://cdn.jsdelivr.net/npm/simple-icons@2.14.0/icons/line.svg></i></a><a href=javascript:void(0); title="分享到 微博" data-sharer=weibo data-url=https://lewky.cn/posts/maven-issues/ data-title=Maven问题汇总><i class="fab fa-weibo fa-fw"></i></a></span></div></div></div><div class=post-info-more><section class=post-tags><i class="fas fa-tags fa-fw"></i>&nbsp;<a href=/tags/maven/>Maven</a>,&nbsp;<a href=/tags/%E5%B7%A5%E4%BD%9C%E8%AE%B0%E5%BD%95/>工作记录</a></section><section><span><a href=javascript:void(0); onclick=window.history.back();>返回</a></span>&nbsp;|&nbsp;<span><a href=/>主页</a></span></section></div><div class=post-nav><a href=/posts/swagger-issues/ class=prev rel=prev title=Swagger问题汇总><i class="fas fa-angle-left fa-fw"></i>Swagger问题汇总</a>
<a href=/posts/npm-issues/ class=next rel=next title=npm问题汇总>npm问题汇总<i class="fas fa-angle-right fa-fw"></i></a></div></div><div id=comments><div id=waline></div><script src=https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js></script><script>new Waline({el:'#waline',meta:["nick","mail","link"],requiredMeta:["nick","mail"],login:"force",placeholder:"为防恶意灌水攻击，评论前需注册并登录，望见谅~",serverURL:"https://comment.lewky.cn/",avatarCDN:"https://sdn.geekzu.org/avatar/",pageSize:20,avatar:"retro",lang:"zh-CN",visitor:true,highlight:true,uploadImage:false,emoji:['https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/emoji/嘉然今天吃什么','https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/emoji/大航海嘉然','https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/emoji/向晚大魔王','https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/emoji/贝拉kira','https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/emoji/珈乐Carol','https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/emoji/乃琳Queen','https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/emoji/EveOneCat','https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo','https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/emoji/滑稽','https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/emoji/default']});</script></div></article></div></main><footer class=footer><div class=footer-container><div class=footer-line><span id=run-time></span>|
<a href=http://rssblog.vercel.app/ target=_blank rel=noopener title=RSSBlog><i class="fas fa-fw fa-inbox"></i>&nbsp;RSSBlog</a></div><div class=footer-line><i class="far fa-copyright fa-fw"></i><span itemprop=copyrightYear>2018 - 2022</span><span class=author itemprop=copyrightHolder>&nbsp;<a href=/ target=_blank>雨临Lewis</a></span>&nbsp;|&nbsp;<span class=license><a rel="license external nofollow noopener noreffer" href=https://creativecommons.org/licenses/by-nc/4.0/ target=_blank>CC BY-NC 4.0</a></span><span class=icp-splitter>&nbsp;|&nbsp;</span><br class=icp-br><span class=icp><a target=_blank href=http://www.beian.miit.gov.cn/ style=font-weight:700>粤ICP备19103822</a></span></div></div></footer></div><div id=fixed-buttons><a href=# id=back-to-top class=fixed-button title=回到顶部><i class="fas fa-arrow-up fa-fw"></i></a><a href=# id=view-comments class=fixed-button title=查看评论><i class="fas fa-comment fa-fw"></i></a></div><div class=sidebar_wo><div id=leimu><img src=https://cdn.jsdelivr.net/gh/lewky/lewky.github.io@master/images/b2t/leimuA.png alt=雷姆 onmouseover="this.src='https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/b2t/leimuB.png'" onmouseout="this.src='https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/b2t/leimuA.png'" title=回到顶部></div><div class=sidebar_wo id=lamu><img src=https://cdn.jsdelivr.net/gh/lewky/lewky.github.io@master/images/b2t/lamuA.png alt=雷姆 onmouseover="this.src='https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/b2t/lamuB.png'" onmouseout="this.src='https:\/\/cdn.jsdelivr.net\/gh\/lewky\/lewky.github.io@master/images/b2t/lamuA.png'" title=回到底部></div></div><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/lightgallery.js@1.2.0/dist/css/lightgallery.min.css><script type=text/javascript src=https://cdn.jsdelivr.net/npm/smooth-scroll@16.1.3/dist/smooth-scroll.min.js></script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/lazysizes@5.2.2/lazysizes.min.js></script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/lightgallery.js@1.2.0/dist/js/lightgallery.min.js></script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/lg-thumbnail.js@1.2.0/dist/lg-thumbnail.min.js></script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/lg-zoom.js@1.2.0/dist/lg-zoom.min.js></script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js></script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/sharer.js@0.4.0/sharer.min.js></script><script type=text/javascript>window.config={"code":{"copyTitle":"复制到剪贴板","maxShownLines":30},"comment":{},"lightGallery":{"actualSize":false,"exThumbImage":"data-thumbnail","hideBarsDelay":2000,"selector":".lightgallery","speed":400,"thumbContHeight":80,"thumbWidth":80,"thumbnail":true}};</script><script type=text/javascript src=/js/theme.min.js></script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/jquery@2.1.3/dist/jquery.min.js></script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/jquery-backstretch@2.1.18/jquery.backstretch.min.js></script><script>var $cdnPrefix="https://cdn.jsdelivr.net/gh/lewky/lewky.github.io@master";</script><script type=text/javascript src=/js/custom.js></script><script>var _hmt=_hmt||[];(function(){var hm=document.createElement("script");hm.src="https://hm.baidu.com/hm.js?6f278ed0fdb01edb3b1e7398379e5432";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm,s);})();</script></body></html>